package com.example.demo.repository;

import com.example.demo.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by Administrator on 2018/1/24 0024.
 */
public interface UserRepository extends JpaRepository<User,Long> {
    @Query("select u from User u where u.id=?1")
    public User findLeaderByParentIdAsId(Long parentId);

    /*查询下级会员代理*/
    @Query("select u from User u where u.parentId=?1")
    public List<User> findAgentByParentId(Long parentId);


    User findOneByName(String str);
}
